<template>
  <div id="Go404">
    <h1>您访问的网页去往了火星!!!!!!!!</h1>
    <h2>
      <span style="color: red; font-size: 20px">{{ num }}</span
      >秒后自动跳转至登录页
    </h2>
    <h3>如需手动跳转,或时间结束未自动请手动点击下方链接</h3>
    <router-link to="/login">点击我去往登录页</router-link>
  </div>
</template>

<script>
export default {
  name: 'Go404',
  data() {
    return {
      num: 5
    }
  },
  mounted() {
    this.$nextTick(() => {
      const timer = setInterval(() => {
        if (this.num === 0) {
          clearInterval(timer)
          this.$store.commit('userModule/setToken', '')
          this.$store.commit('userModule/setUserInfo', '')
          this.$router.replace('/login')
        }
        this.num--
      }, 1000)
    })
  }
}
</script>

<style lang="less" scoped></style>
